package com.x.erp.controller;

import org.apache.commons.lang.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.dubbo.config.annotation.Reference;
import com.x.erp.model.CarLog;
import com.x.erp.rpc.CarLogRpcService;
import com.x.framework.controller.BaseController;
import com.x.framework.controller.ResultCode;
import com.x.framework.controller.ResultModel;
/**
 * 车龄日志记录Controller
 *
 * @author pansong
 */
@RestController
@RequestMapping(value = "/carLog")
public class CarLogController extends BaseController {

	@Reference
	private CarLogRpcService carLogRpcService;// 车辆日志记录服务
	
	/**
	 * 查询车辆日志记录列表
	 *
	 * @param carLog
	 * @return
	 */
	@RequestMapping(value = "/getCarLogList", method = { RequestMethod.POST, RequestMethod.GET })
	public ResultModel getCarLogList(CarLog carLog) {
		if(carLog == null){
			return new ResultModel(ResultCode.RESULT_FAIL, "车辆日志信息不能为空！");
		}
		if(StringUtils.isEmpty(carLog.getCarId())){
			return new ResultModel(ResultCode.RESULT_FAIL, "车辆Id为空！");
		}
		return new ResultModel(ResultCode.RESULT_SUCCESS, "查询成功", carLogRpcService.selectCarLogList(carLog));
	}
}
